<div ng-controller="postageCtrl">
    <div class="bg-light lter b-b wrapper-md ng-scope">
        <h4 class="m-n font-thin">运费模板管理</h4>
    </div>
    <div class="wrapper-md">
        <div class="panel-body panel-default panel">
            <div class="panel-body bg-light">
                <div>
                    <div class="panel-body panel">
                        <a href="" class="b-a b-success btn btn-sm text-success h6 m-r-sm" ui-sref="app.postageAdd">新建模板</a>
                        <span class="text-muted h6">开启商家配送的商户需设置，最多可创建100个</span>
                    </div>
                    <div>
                        <div class="panel" ng-repeat="item in list" ng-init="item.show=true">
                            <div class="panel-heading panel-default">
                                <span class="inline"><p class="font-bold inline m-t-n m-b-n m-r-xs">{{item.name}}</p><p class="h6 inline m-n" ng-bind="{'0':'重量计费','1':'个数计费'}[item.valuateType]"></p></span>
                                <div class="pull-right">
                                    <a class="text-success inline h6" ui-sref="app.postageEdit({id:item.id})">编辑</a>
                                    <a class="text-success inline h6">-</a>
                                    <a class="text-success inline h6 m-r-xs" ng-click="del(item.id)" ng-if="item.useCount==0">删除</a>
                                    <a class="text-muted inline h6 m-r-xs" ng-if="item.useCount>0">模板正在使用,无法删除</a>
                                    <a class="fa fa-caret-down text-success inline h6" ng-click="item.show=!item.show"></a>
                                </div>
                            </div>
                            <table class="table table-bordered m-n fa-border" ng-if="item.show">
                                <thead>
                                    <tr>
                                        <th>可配送区域</th>
                                        <th>首件（kg）</th>
                                        <th>运费(元)</th>
                                        <th>续件（kg）</th>
                                        <th>续费(元)</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="subitem in item.childrens">
                                        <td width="40%">
                                            <span class="h6">{{subitem.areaContent}}</span>
                                        </td>
                                        <td>
                                            {{subitem.basicQuality}}
                                        </td>
                                        <td>
                                            {{subitem.basicPostage}}
                                        </td>
                                        <td>
                                            {{subitem.incrementQuality}}
                                        </td>
                                        <td>
                                            {{subitem.incrementPostage}}
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>

                </div>
                <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                    <span class="h6">~未搜索到任何数据~</span>
                </div>
                <div>
                    <circle-loading ng-if="app.loading"></circle-loading>
                </div>
            </div>
        </div>
    </div>
</div>